﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body>

    <h1>
        Attributes</h1>
    <p>
        CLR Attributes are used to control how CLR types are serialized and identified 
        by CIPl.</p>
    <h2>
        CIP4ItemAttribute</h2>
    <p>
        The presence of this attribute indicates that the associated type is visible to 
        CIPl. Code for all the types in an assembly with a CIP4Item attribute will be 
        included in the generated serializer. For example:</p>
    <pre>
    [CIP4Item(AddAllProperties = true, Collection = "People")]
    public class PersonType
    {
        [CIP4ExternalID]
        public string Name { get; set; }
        public AddressType Address { get; set; }
        public Dictionary<string, AddressType> AlternateAddresses { get; set; }
        public Dictionary<string, string> Tags { get; set; }
        public Stream Portrait { get; set; }
    }    
    </pre>
    <p>
        The attribute has the following 
        properties:</p>
    <h3>
        ActualName</h3>
    <p>
        This is the name that will be used in building the xml representation of the 
        item. By default this is the same as the name of the type the attribute is 
        attached to Use this property if you have more than one CIP4 collection of the 
        same type.</p>
    <h3>
        Collection</h3>
    <p>
        This is the collection that instances of this account will be found in and saved 
        to, If this property is not specified the type name will be used as the default 
        value.</p>
    <h3>
        AddAllProperties</h3>
    <p>
        If true - all properties in the class will be used in serialization and 
        deserialization</p>
    <h3>
        VersionDomain</h3>
    <p>
        If supplied, this will be used as the domain part of the version namespaces used 
        to identify the version of serialized objects - for example if VersionDomain is 
        foo.com the CIPl item namespace used when serializing the item in xml will be
        <a href="http://foo.com/CIPlItem1.xsd">http://foo.com/CIPlItem1.xsd</a></p>
    <h3>
        DontSerialize</h3>
    <p>
        If true, the associated type will not be serialized and will not be included in 
        any generated serializer</p>
    <h2>
        CIP4PropertyAttribute</h2>
    <p>
        In the absence of AddAllProperties on the CIP4Item attribute, only properties 
        with the CIP4Property attribute will be serialized. </p>
    <p>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [CIP4Property(IsIndexed=true)]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public Dictionary<string, string> Tags { get; set; }</p>
    <p>
        The attribute has the 
        following properties:   determining the declared order. If Ordinal is not specified the properties will 
        be serialized in alphabetical order. Any properties with the same Ordinal will 
        be ordered firstly by Ordinal and then by name. The value zero will be ignored.</p>
    <h3>
        &nbsp;DontSerialize</h3>
    <p>
        If true, the associated property will not be serialized.</p>
    <h3>
        SerializeTarget</h3>
    <p>
        If true, the target type for the property will be serialized even if it does not 
        have a CIP4ItemAttribute.</p>
    <h3>
        IsIndexed</h3>
    <p>
        If true - indicates to any underlying DataProvider that the property sould be 
        indexed if possible </p>
    <h2>
        CIP4ExternalIDAttribute</h2>
    <p>
        Every CIP4Item type must have one or more properties with the ExternalID 
        attribute associated with them. The properties are concatenated (using an &#39;_&#39; 
        charcater) to make up the externalID value that is used to identify the item. 
        Two items with the same ExternalID value are considerted to be the same item. 
        The ExternalID atribute has one property</p>
    <h3>
        Rank</h3>
    <p>
        Indicates the sequence in which the ExternalID properties are concatenated to 
        make up the ExternalID value. If rank is not specified, the ExternalID 
        properties will be concatenated in alphabetical order (by property name).</p>
    <h2>
        CIP4ItemVersionAttribute</h2>
    <p>
        The associated property is used as the version property for the item. This is 
        the property that controls optmistic concurrency behavior - it&#39;s value is 
        checked before update to ensure that the item has not been changed since it was 
        last read. The property must be either DatetTime or Int64</p>

</body>
</html>
